package tools;

import core.DrawContext;
import core.Object2D;
import core.OurGraphics;
import core.Point3D;
import core.VectorialObject;

public class RectTool extends GeometricTool {
	
	private RectProxy proxy = new RectProxy();

	@Override
	public void draw(Point3D p1, Point3D p2, DrawContext ctx) {
		_draw(p1,p2,ctx.getGraphics());
	}

	@Override
	public Object2D getProxy() {
		return proxy;
	}
	
	private void _draw(Point3D p1, Point3D p2, OurGraphics g2){
		
		g2.setColor(getColor());
		
		g2.drawSquare(p1, p2);
	}
	
	private class RectProxy implements Object2D{

		@Override
		public void draw(OurGraphics g2) {
			
			if(!firstSelected){
				return;
			}
			
			_draw(firstPoint, secondPoint, g2);
		}
		
	}

	@Override
	public void onSelection(VectorialObject vo) {
		// TODO Auto-generated method stub
		
	}


}
